package uk.ac.aber.Blockmation;

import java.io.File;

/**
 * This class initiates an instance of the specific ViewerSplash with a Movie
 * Model from a GIF file. Could have been implemented inside the MainAppDriver, 
 * but seperated to keep the code clean.
 * @author alex
 */
public class SplashScreen {
    
    private ViewerSplash viewerSplash;
    private final String splashFile = "src/uk/ac/aber/Blockmation/splash.gif";
    
    public SplashScreen() {
        
        // Create instance of MovieModel
        MovieModel movieModel = new MovieModel();
        
        // Load animation from file
        File file = new File(splashFile);
        movieModel = FileManager.loadMovie(file);
        movieModel.setSpeed(50);
        
        // Create Instance of Viewer
        viewerSplash = new ViewerSplash(movieModel);
        viewerSplash.setUndecorated(true);
        
        
        viewerSplash.pack();
        viewerSplash.setLocationRelativeTo(null);
        viewerSplash.setVisible(true);
        
    }
    
    public boolean isRunning() {
        
        return viewerSplash.getStatus();
    }
    
    public void hide() {
        //viewerSplash.setVisible(false);
        viewerSplash.dispose();
    }
    

}
